package com.cloudlead.plugin.scheduler.vo;

import com.cloudlead.plugin.scheduler.action.validator.ScheduleJobInstanceValidatorGroup;
import com.cloudlead.plugin.scheduler.action.validator.ScheduleJobValidatorGroup;
import com.cloudlead.common.lang.persistence.AbstractIdEntity;

import javax.validation.constraints.Size;
import java.lang.Long;
import com.cloudlead.common.lang.annotation.BelongsTos;
import com.cloudlead.common.lang.annotation.Domain;
import com.cloudlead.common.lang.annotation.Label;
import java.lang.String;
import javax.validation.constraints.NotNull;
import com.cloudlead.plugin.scheduler.vo.dict.JobInstanceStatus;

/**
 * ScheduleJobInstance is a Codegen vo type
 */
@Label("计划任务实例")
@Domain(domainClassName="com.cloudlead.plugin.scheduler.entity.EScheduleJobInstance")
@BelongsTos(values = {
	@com.cloudlead.common.lang.annotation.BelongsTo(property="job", rootField="jobId")
})
public class ScheduleJobInstance extends AbstractIdEntity<String> {

    private static final long serialVersionUID =289731751371689L;    
    @Size(max=24)
    @Label("编号")
    @NotNull(groups={ScheduleJobValidatorGroup.Update.class})
    private String id;

    @Label("所属任务")
    @NotNull(groups={ScheduleJobInstanceValidatorGroup.Create.class,ScheduleJobInstanceValidatorGroup.Update.class})
    private ScheduleJob job;

    @Label("开始时间")
    private Long startTime;

    @Label("任务实例状态")
    @NotNull(groups={ScheduleJobInstanceValidatorGroup.Create.class,ScheduleJobInstanceValidatorGroup.Update.class})
    private JobInstanceStatus status;

    @Label("停止时间")
    private Long stopTime;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public ScheduleJob getJob() {
        return job;
    }

    public void setJob(ScheduleJob job) {
        this.job = job;
    }

    public Long getStartTime() {
        return startTime;
    }

    public void setStartTime(Long startTime) {
        this.startTime = startTime;
    }

    public JobInstanceStatus getStatus() {
        return status;
    }

    public void setStatus(JobInstanceStatus status) {
        this.status = status;
    }

    public Long getStopTime() {
        return stopTime;
    }

    public void setStopTime(Long stopTime) {
        this.stopTime = stopTime;
    }

    public String toString() {
         return String.format("ScheduleJobInstance { id : %s,job : %s,startTime : %s,status : %s,stopTime : %s }",id,job,startTime,status,stopTime);
    }

}

